package c.e.a.c.l;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import androidx.recyclerview.widget.RecyclerView;
import c.e.a.c.l.d.d;
import c.e.a.c.l.d.f;
import com.google.android.material.datepicker.MaterialCalendarGridView;
import java.util.Iterator;

/* compiled from: MonthsPagerAdapter */
public class n implements OnItemClickListener {
    public final /* synthetic */ MaterialCalendarGridView a;
    public final /* synthetic */ o b;

    public n(o oVar, MaterialCalendarGridView materialCalendarGridView) {
        this.b = oVar;
        this.a = materialCalendarGridView;
    }

    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        m a = this.a.getAdapter();
        Object obj = (i < a.a() || i > a.c()) ? null : 1;
        if (obj != null) {
            f fVar = this.b.e;
            long longValue = this.a.getAdapter().getItem(i).longValue();
            d dVar = (d) fVar;
            if (d.this.Z.d.k(longValue)) {
                d.this.Y.h0(longValue);
                Iterator it = d.this.W.iterator();
                while (it.hasNext()) {
                    ((p) it.next()).a(d.this.Y.v());
                }
                d.this.f0.getAdapter().a.b();
                RecyclerView recyclerView = d.this.e0;
                if (recyclerView != null) {
                    recyclerView.getAdapter().a.b();
                }
            }
        }
    }
}
